import React, { Component } from 'react'
export class Test extends Component {
  constructor(props) {
    super(props)
    this.state = {
      movies: [11, 22, 33, 44],
    }
  }
  insertMoive = () => {
    this.setState({
      movies: [...this.state.movies, '666'],
    })
  }
  insertMoive2 = () => {
    this.setState({
      movies: ['777', ...this.state.movies],
    })
  }
  render() {
    return (
      <>
        <button onClick={() => this.insertMoive2()}>前插入新电影</button>
        {this.state.movies.map((moive, index) => {
          return <div key={moive}>{moive}</div>
        })}
        <button onClick={() => this.insertMoive()}>后插入新电影</button>
      </>
    )
  }
}
